package org.magicsoft.office.excel.model;

import java.util.ArrayList;
import java.util.List;

public class ResultItem {

	private String fileName = null;

	private String sheetName = null;

	private List<CountData> countDatas = null;

	private String errorMessge = null;

	private int insertCount = 0;

	private int updateCount = 0;

	public ResultItem(String fileName, String sheetName) {
		this.fileName = fileName;
		this.sheetName = sheetName;
	}

	public String getFileName() {
		return fileName;
	}

	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	public String getSheetName() {
		return sheetName;
	}

	public void setSheetName(String sheetName) {
		this.sheetName = sheetName;
	}

	public List<CountData> getCountDatas() {
		return countDatas;
	}

	public void addCountDatas(CountData countData) {
		if (this.countDatas == null) {
			this.countDatas = new ArrayList<>();
		}
		this.insertCount += countData.getInsertCount();
		this.updateCount += countData.getUpdateCount();
		this.countDatas.add(countData);
	}

	public String getErrorMessge() {
		return errorMessge;
	}

	public void setErrorMessge(String errorMessge) {
		this.errorMessge = errorMessge;
	}

	public int getInsertCount() {
		return insertCount;
	}

	public void setInsertCount(int insertCount) {
		this.insertCount = insertCount;
	}

	public int getUpdateCount() {
		return updateCount;
	}

	public void setUpdateCount(int updateCount) {
		this.updateCount = updateCount;
	}

	public int getDataCount() {
		return this.getInsertCount() + this.getUpdateCount();
	}

}
